<template>
  <div>
    <template v-if="!endVal">
      <a-spin size="small" />
    </template>
    <template v-else>
      <countTo
        :decimals="count.decimals"
        :startVal="count.startVal"
        :endVal="endVal"
        :duration="count.duration"
      />
      <template v-if="unit">
        {{ " " + unit }}
      </template>
    </template>
  </div>
</template>

<script>
import countTo from "vue-count-to";
export default {
  name: "VCountTo",
  props: {
    endVal: {
      type: Number,
      default: undefined,
    },
    unit: {
      type: String,
      default: undefined,
    },
  },
  components: {
    countTo,
  },
  data() {
    return {
      count: {
        startVal: 0,
        decimals: 2,
        duration: 3000,
      },
    };
  },
  mounted() {},
  watch: {},
  methods: {},
};
</script>